package object_oriented;

public class Chronology {
    // private 表示私有的
    private static final char[] HEAVENLY_STEMS ; // 天干
    // static 表示与类相关的、属于类的
    private static final char[] EARTHLY_BRANCHES ; // 地支
    // final 表示最终的、不可更改的
    private static final char[] CHINESE_ZODIAC ; // 生肖
    private static final int CONTRAST = 1984 ; // 1984 年 ( 甲子年 ，生肖为 鼠 )

    static {
        HEAVENLY_STEMS = new char[] { '甲' , '乙' , '丙' , '丁' , '戊' , '己' , '庚' , '辛' , '壬' , '癸' };
        EARTHLY_BRANCHES = new char[] { '子' , '丑' , '寅' , '卯' , '辰' , '巳' ,  '午' , '未' , '申' , '酉' , '戌' , '亥' };
        CHINESE_ZODIAC = new char[] { '鼠','牛','虎','兔','龙','蛇','马','羊','猴','鸡','狗','猪' } ;
    }
    public static void show(){
        for (int i = 0; i < 60; i++) {
            if ( (i%12) == 0){
                System.out.println();
            }
            System.out.print( HEAVENLY_STEMS [ i % 10 ]);
            System.out.print( EARTHLY_BRANCHES [ i % 12 ] + " ");
        }
    }
    public static String seek( int year ) {
        year = ( year - 1984 ) % 60;
        String str = HEAVENLY_STEMS [ year % 10 ] + EARTHLY_BRANCHES [ year % 12 ] + "" ;
        return str ;
    }
    public static char sign( int year ) {
        year = ( year - 1984 ) % 12;
        char str = CHINESE_ZODIAC [ year ] ;
        return str ;
    }
}
